<template>
  <div>
    <div class="test">

      <!-- <el-form :model="formData" :rules="rules">
        <el-form-item label="手机号" prop="mobile">
          <el-input v-model="formData.mobile" />
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input v-model="formData.password" />
        </el-form-item>
        <el-form-item label="再次输入密码" prop="password2">
          <el-input v-model="formData.password2" />
        </el-form-item>
      </el-form>

      <button @click="getUserInfo">获取当前用户数据</button>

      <input v-autofocus type="text">
      <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick">
        <span slot-scope="{ data }" class="custom-tree-node">
          <span>部门名称：{{ data.title }}</span>
        </span>
      </el-tree>
    </div>

    <el-row type="flex" justify="space-between" style="width:100%">
      <el-col :span="3">你好</el-col>
      <el-col :span="2" style="color:#000">你也好</el-col>
    </el-row> -->
      <hr>
      <image-upload />
    <!-- <component :is="ImageUpload" /> -->
    </div>
  </div></template>

<script>
// import { getUserInfo } from '@/api/user'
export default {
  data() {
    const checkPassword2 = (rule, val, callback) => {
      if (val === this.formData.password) {
        // 成功
        callback()
      } else {
        callback(new Error('两次输入密码必须一致'))
      }
    }
    return {
      treeData: [{ title: '总裁办' },
        { title: '认识总部' },
        { title: '分公司1', children: [
          { title: '销售部' },
          { title: '市场部' }
        ] },
        { title: '分公司1', children: [
          { title: '销售部' },
          { title: '市场部' }
        ] }
      ],
      formData: {
        mobile: '',
        password: '',
        password2: ''
      },
      rules: {
        mobile: [
          { required: true, message: '该项不能为空', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '该项不能为空', trigger: 'blur' }
        ],
        password2: [
          { required: true, message: '该项不能为空', trigger: 'blur' },
          { trigger: 'blur', validator: checkPassword2 }
        ]
      }
    }
  },
  methods: {
    async getUserInfo() {
      // const res = await getUserInfo()
      // console.log(res)
      this.$store.dispatch('user/getUserInfo')
    }
  }
}
</script>

<style scoped lang="scss">
.test{
  margin-left: 50px;
  width: 300px;
}
</style>
